<?php
// 启动会话
session_start();
?>

<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container">
        <a class="navbar-brand" href="index.php">小工具主页</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
                <?php if (!isset($_SESSION['isLoggedIn']) || $_SESSION['isLoggedIn'] !== true) : ?>
                    <li class="nav-item">
                        <a class="nav-link" href="login.html">登录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="register.html">注册</a>
                    </li>
                <?php else : ?>
                    <li class="nav-item">
                        <a class="nav-link" href="user-center.php">用户中心</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="logout.php">退出</a>
                    </li>
                <?php endif; ?>
            </ul>
        </div>
    </div>
</nav>